package apiv1

import (
	"gin-mvc/controllers"
	"gin-mvc/models/admin"
	"gin-mvc/pkg/exceptions"
	"gin-mvc/services"
)

type TagController struct {
	controllers.BaseController
}

var tagService services.TagService

func init() {
	tagService = services.NewTagService()
}

func (ctl *TagController) Index() {
	tags := tagService.Tags()
	ctl.SendJson(exceptions.Success, tags)

	return
}

func (ctl *TagController) Create() {
	tag := admin.Tag{
		Name:  "1",
		State: 1,
	}
	id := tagService.CreateTag(&tag)
	data := make(map[string]int64)
	data["id"] = id
	ctl.SendJson(exceptions.Success, id)

	return
}
